home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C++ / Applications / CheckBook 2.1d1 / Sources / UEditTransactionCommand.cp < prev    next >
Encoding:
Text File  |  1995-09-24  |  5.1 KB  |  96 lines  |  [TEXT/BROW]

  1. ount->ForceRedraw();
  2.                     fComments->ForceRedraw();
  3.                     fDate->ForceRedraw();
  4.                     fMyRef->ForceRedraw();
  5.                     fTheirRef->ForceRedraw();
  6.                     fType->ForceRedraw();
  7.                     fReconciled->ForceRedraw();
  8.                     fBalance->ForceRedraw();
  9.                     
  10.                     aWindow->PopulatePopup();
  11.                     aWindow->SetCurrentPopupItem();
  12.                 }
  13.                 break;
  14.         }
  15.     } // while more
  16.     aWindow->CloseAndFree();
  17.  
  18.     TCommand::DoIt ();
  19. }
  20.  
  21. #pragma segment TEditTransactionCommand
  22. void TEditTransactionCommand::SetTransaction(TTransaction *theTransaction, Boolean isNew)
  23. {
  24.     assert(theTransaction);
  25.     
  26.     fMyTransaction = theTransaction;
  27.     fIsNew = isNew;
  28. }
  29.  
  30. #pragma segment TEditTransactionCommand
  31. void TEditTransactionCommand::PopulateDialog()
  32. {
  33.     CStr255    tempStr;
  34.     tempStr = fMyTransaction->fType;
  35.     fType->SetText(tempStr, kDontRedraw);
  36.     
  37.     tempStr = fMyTransaction->fComment;
  38.     fComments->SetText(tempStr, kDontRedraw);
  39.  
  40.     fMyTransaction->GetDateAsString(tempStr);
  41.     fDate->SetText(tempStr, kDontRedraw);
  42.  
  43.     fMyDoc->GetBalance(tempStr);
  44.     fBalance->SetText(tempStr, kDontRedraw);
  45.     
  46.     char    tempCStr[32];
  47.     float    value;
  48.     value = fMyTransaction->fCents;    // convert to float for display
  49.     value /= 100;
  50.     sprintf(tempCStr, "%.2f", value);
  51.     fAmount->SetText(tempCStr, kDontRedraw);
  52.         
  53.     tempStr = fMyTransaction->fMyRef;
  54.     fMyRef->SetText(tempStr, kDontRedraw);
  55.     
  56.     tempStr = fMyTransaction->fTheirRef;
  57.     fTheirRef->SetText(tempStr, kDontRedraw);
  58.     
  59.     fReconciled->SetState(fMyTransaction->fReconciled, kDontRedraw);
  60. }
  61.  
  62.  
  63. #pragma segment TEditTransactionCommand
  64. void TEditTransactionCommand::DePopulateDialog()
  65. {
  66.     CStr255    tempStr;
  67.     fType->GetText(tempStr);
  68.     strcpy(fMyTransaction->fType, tempStr);
  69.     
  70.     fComments->GetText(tempStr);
  71.     strcpy(fMyTransaction->fComment, tempStr);
  72.  
  73.     fDate->GetText(tempStr);
  74.     if(fMyTransaction->SetDateRec(tempStr))
  75.         ApplicationBeep();    // got an error, do something sensible!
  76.     
  77.     fAmount->GetText(tempStr);
  78.     fMyTransaction->fCents = ::AmtStringToCents(tempStr);
  79.  
  80.     fMyRef->GetText(tempStr);
  81.     strcpy(fMyTransaction->fMyRef, tempStr);
  82.     
  83.     fTheirRef->GetText(tempStr);
  84.     strcpy(fMyTransaction->fTheirRef, tempStr);
  85.     
  86.     fMyTransaction->fReconciled = fReconciled->IsOn();
  87. }
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.